import request from '@/utils/request'

// 查询产线列表
export function listProductLline(query) {
  return request({
    url: '/mes/productLline/list',
    method: 'get',
    params: query
  })
}

// 查询产线详细
export function getProductLline(id) {
  return request({
    url: '/mes/productLline/' + id,
    method: 'get'
  })
}

// 新增产线
export function addProductLline(data) {
  return request({
    url: '/mes/productLline',
    method: 'post',
    data: data
  })
}

// 修改产线
export function updateProductLline(data) {
  return request({
    url: '/mes/productLline',
    method: 'put',
    data: data
  })
}

// 删除产线
export function delProductLline(id) {
  return request({
    url: '/mes/productLline/' + id,
    method: 'delete'
  })
}

// 导出产线
export function exportProductLline(query) {
  return request({
    url: '/mes/productLline/export',
    method: 'get',
    params: query
  })
}
//产线树形结构
export function treeselect() {
  return request({
    url: '/mes/prosite/treeselect',
    method: 'get'
  })
}

//产线包含的工位
export function siteListOfPro(query) {
  return request({
    url: '/mes/prosite/list',
    method: 'get',
    params: query
  })

}
//找到产线工位

export function getOneSiteOfPro(id) {
  return request({
    url: '/mes/prosite/' + id,
    method: 'get'
  })

}
//更新顺序
export function updateSiteNumOfPro(id, num) {

  return request({
    url: '/mes/prosite',
    method: 'put',
    data: {
      "id": id,
      "num": num
    }
  })
}
//为产线添加工位
export function addSiteForPro(data) {

  return request({
    url: '/mes/prosite',
    method: 'post',
    data: data
  })
}

//删除产线里的工位
export function delSiteForPro(ids) {

  return request({
    url: '/mes/prosite/' + ids,
    method: 'delete'
  })
}


export function saveSiteSetForPro(data) {

  return request({
    url: '/mes/opc_set',
    method: 'put',
    data: data
  })
}

export function siteActList(query) {

  return request({
    url: '/mes/site_act/list',
    method: 'get',
    params: query
  })
}
export function getActOne(id) {

  return request({
    url: '/mes/site_act/' + id,
    method: 'get'
  })
}


export function addAct(data) {

  return request({
    url: '/mes/site_act',
    method: 'post',
    data: data
  })
}

export function delAct(ids) {

  return request({
    url: '/mes/site_act/' + ids,
    method: 'delete'
  })
}
export function upAct(data) {

  return request({
    url: '/mes/site_act',
    method: 'put',
    data: data
  })
}


//参数列表
export function siteParamList(query) {
  return request({
    url: '/mes/site_param/list',
    method: 'get',
    params: query
  })

}
//添加参数
export function addParamForSite(data) {
  return request({
    url: '/mes/site_param',
    method: 'post',
    data: data
  })

}

//编辑a参数
export function editParamForSite(data) {
  return request({
    url: '/mes/site_param',
    method: 'put',
    data: data
  })

}

export function delParamForSite(ids) {

  return request({
    url: '/mes/site_param/' + ids,
    method: 'delete'
  })
}

export function getOpc(query) {
  return request({
    url: '/mes/opc/one',
    method: 'get',
    params: query
  })

}
